#include "mainwindow.h"

#include <QApplication>
#include <QDebug>

#include "loginwindow.h"
#include "startupwindow.h"

int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    a.setApplicationName("学生管理系统");



    QPixmap pix(":/splash.png");
    if(pix.isNull()) pix = QPixmap(600,400);
    SplashScreen splash(pix);
    splash.start();
    splash.show();

    LoginDialog login;
    QObject::connect(&splash, &SplashScreen::finished, &splash, [&]{
        splash.close();
        login.exec();
    });



    QObject::connect(&login, &LoginDialog::loginSuccess, &login, [&] {
        MainWindow* w = new MainWindow(login.username());
        w->show();
    });


    return a.exec();
}
